﻿using Microsoft.Expression.Interactivity.Layout;
using Microsoft.Practices.Prism.ViewModel;
using System;
using System.Windows.Media;

namespace FPSO.HMI.Controls
{
    public class AlarmInfo : NotificationObject
    {
		public AlarmInfo()
		{
			LogId = 0;
			LogName = string.Empty;
			LogType = -1;
			LogState = -1;
			LogCreateTime = DateTime.MinValue;
			LogUpdateTime = DateTime.MinValue;
		}

		private int logId;
        public int LogId
        {
            get { return logId; }
            set
            {
                if (logId != value)
                {
                    logId = value;
                    RaisePropertyChanged("LogId");
                }
            }
        }

        private string logName;
        public string LogName
        {
            get { return logName; }
            set
            {
                if (logName != value)
                {
                    logName = value;
                    RaisePropertyChanged("LogName");
                }
            }
        }

		//logType=0,通讯报警信息，logType=1,船舶状态预警信息，logType=2,船舶状态报警信息，
		//logType=3,舱室状态预警信息，logType=4,舱室状态报警信息，logType=5,设备状态报警信息，
		//logType=6,用户操作信息，logType=7,系统提示信息，
		private int logType;
        public int LogType
        {
            get { return logType; }
            set
            {
				if (logType != value)
				{
					logType = value;

					switch (logType)
					{
						case 0:
							LogTypeStr = "通讯报警";
							LogBkColor = new SolidColorBrush(Colors.Yellow);
							break;
						case 1:
							LogTypeStr = "船舶状态预警";
							LogBkColor = new SolidColorBrush(Colors.Orange);
							break;
						case 2:
							LogTypeStr = "船舶状态报警";
							LogBkColor = new SolidColorBrush(Colors.Red);
							break;
						case 3:
							LogTypeStr = "舱室状态预警";
							LogBkColor = new SolidColorBrush(Colors.Orange);
							break;
						case 4:
							LogTypeStr = "舱室状态报警";
							LogBkColor = new SolidColorBrush(Colors.Red);
							break;
						case 5:
							LogTypeStr = "设备状态报警";
							LogBkColor = new SolidColorBrush(Colors.OrangeRed);
							break;
						case 6:
							LogTypeStr = "用户操作";
							LogBkColor = new SolidColorBrush(Colors.LightGreen);
							break;
						case 7:
							LogTypeStr = "系统提示";
							LogBkColor = new SolidColorBrush(Colors.LightYellow);
							break;
					}
					RaisePropertyChanged("LogType");
                }
            }
        }


		private string logTypeStr;
		public string LogTypeStr
		{
			get { return logTypeStr; }
			set
			{
				if (logTypeStr != value)
				{
					logTypeStr = value;
					RaisePropertyChanged("LogTypeStr");
				}
			}
		}

		private SolidColorBrush logBkColor;
		public SolidColorBrush LogBkColor
		{
			get { return logBkColor; }
			set
			{
				logBkColor = value;
				RaisePropertyChanged("LogBkColor");
			}
		}

		private int logState;
        public int LogState
        {
            get { return logState; }
            set
            {
                if (logState != value)
                {
                    logState = value;
                    RaisePropertyChanged("LogState");
                }
            }
        }

        private DateTime logCreateTime;
        public DateTime LogCreateTime
        {
            get { return logCreateTime; }
            set
            {
                if (logCreateTime != value)
                {
                    logCreateTime = value;
                    RaisePropertyChanged("LogCreateTime");
                }
            }
        }

        private DateTime logUpdateTime;
        public DateTime LogUpdateTime
        {
            get { return logUpdateTime; }
            set
            {
                if (logUpdateTime != value)
                {
                    logUpdateTime = value;
                    RaisePropertyChanged("LogUpdateTime");
                }
            }
        }
    }
}
